<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/18 0018
  Time: 20:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>客户转移</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">转移对象：</label>
            <div class="layui-input-inline">
                <select name="source" lay-verify="required" lay-search="">
                    <option value="">请选择</option>
                    <option value="1">注册会员</option>
                    <option value="2">朋友介绍</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">转移到：</label>
            <div class="layui-input-inline">
                <select name="level" lay-verify="required" lay-search="">
                    <option value="">请选择</option>
                    <option value="1">☆</option>
                    <option value="2">☆☆</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">转移原因：</label>
        <div class="layui-input-inline">
            <textarea cols="67" rows="7" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item" style="width: 450px;margin-top: 40px;">
        <div class="layui-input-block">
            <button lay-submit lay-filter="save" class="layui-btn" style="margin-left: 135px;">重置</button>
            <button lay-submit lay-filter="transfer" class="layui-btn">转移</button>
        </div>
    </div>
</form>

<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','jquery'], function(){
        var layer = layui.layer
            ,form = layui.form;
        var $=layui.$;
        //异步提交表单
        form.on("submit(transfer)",function (data) {
            $.post("${pageContext.request.contextPath}/customer/transfer",data.field,function (result) {
                if (result.code==0){
                    layer.msg("转移成功！");
                    //刷新父窗口内容
                    parent.layui.table.reload("customerTable",{
                        page:{
                            curr:1
                        }
                    })
                    //关闭弹出
                    var index=parent.layer.getFrameIndex(window.name);//先得到当前frame层的索引
                    parent.layer.close(index);//再执行关闭
                }
            },"json")
            return false;//阻止表单提交
        })
    });
</script>
</body>
</html>
